package demo1;


class Base{
    public int a=1;
    public int b=2;
}
class Derived extends Base{
    public int a=100;
    public int c=3;


    public void test(){
        System.out.println(super.a);
        System.out.println(this.a);//this优先访问子类的a
        System.out.println(this.b);
        System.out.println(this.c);
        //如果子类有，优先访问子类，如果子类没有，就会访问父类
    }
}
public class Test3 {
    protected  int a=10;
    public static void main(String[] args) {
        Derived derived=new Derived();
        derived.test();
    }
}
